<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/css/styletable.css" type="text/css"/>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <script src="/layui/layui.all.js" charset="utf-8"></script>
    <script src="/js/jquery.2.1.4.js" charset="utf-8"></script>
    <script type="text/javascript" src="/raty/demo/js/jquery.min.js"></script>
    <script src="/laydate/laydate.js"></script>
<body>

<script>
    $(function () {
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '#startdate'
                , type: 'datetime'
                , format: 'yyyy-MM-dd HH:mm'
            });
            laydate.render({
                elem: '#enddate'
                , type: 'datetime'
                , format: 'yyyy-MM-dd HH:mm'
            });
        });
    });

    function detail(th) {
        var prob;
        var pid = $(th).parent().prevAll(".pid").children().val();
        var ptitle = $(th).parent().prevAll(".ptitle").html();
        layer.open({
            title: ptitle,
            type: 2,
            area: ['85%', '85%'],
            content: '/prob/detail/' + pid
        });
        return false;
    }
</script>

<div style="margin: 10px 15px 0px 15px">
    <div style="margin-top: 1px;margin-left: 1px;margin-bottom: 10px;border: 1px solid;border-color:#cecece">
        <form id="findReport" action="/prob/search">
            <div style="text-align: left;background-color: #f2f2f2;width: 100%;height: 30px;border-bottom: 1px solid;border-color:#cecece">
                <span style="margin-left: 20px;line-height: 30px;color: #393939">筛选</span></div>
            <div style="height: 40px">
                <input type="text" name="ptitle"
                       style="border: 1px solid;height: 30px;width:20%;border-color: #cecece;margin: 5px 0px 4px 1%"
                       placeholder="请输入标题">
                <select name="pstate"
                        style="height: 30px;width:12%;border: 1px solid;border-color: #cecece;margin-left: 1%;color:#767676">
                    <option value="">问题状态</option>
                    <option>进行中</option>
                    <option>已结束</option>
                </select>
                <select name="prstate"
                        style="height: 30px;width:12%;border: 1px solid;border-color: #cecece;margin-left: 1%;color:#767676">
                    <option value="">回复状态</option>
                    <option>未回复</option>
                    <option>已回复</option>
                </select>
                <input type="text" name="startd" id="startdate" style="height: 30px;width:14%;margin-left: 1%;"
                       placeholder="开始时间">
                <input type="text" name="endd" id="enddate" style="height: 30px;width:14%;margin-left: 1%;"
                       placeholder="结束时间">
                <a style="float: right;margin: 5px 3% 4px 1%" class="layui-btn layui-btn-edit" href="/prob/excel">
                    excel导出
                </a>
                <button type="submit" style="float: right;margin: 5px 0% 4px 0%" class="layui-btn layui-btn-fun">
                    搜索
                </button>
            </div>
        </form>
    </div>
    <table style="width: 100%">

        <tr>
            <th width="5%"></th>
            <th width="35%">标题</th>
            <th width="25%">创建时间</th>
            <th width="15%">状态</th>
            <th width="20%">操作</th>
        </tr>

        <c:forEach items="${probs}" var="prob">
            <tr>
                <td class="pid" align="center"><input class="check" name="checks" value="${prob.pid}"
                                                          type="checkbox"/></td>
                <td class="ptitle">${prob.ptitle}</td>
                <td>${prob.pdate}</td>
                <td align="center"><span class="layui-btn layui-btn-mini
                    <c:if test="${prob.pstate=='已结束'}">layui-btn-warm</c:if>">${prob.pstate}</span>
                </td>
                <td align="center">
                    <button class="layui-btn layui-btn-small layui-btn-delete" onclick="return detail(this);">查看详情
                    </button>
                </td>
            </tr>
        </c:forEach>
    </table>
</div>
</body>
</html>
